package com.jiexin.controller;

import com.jiexin.beans.PageQuery;
import com.jiexin.common.JsonData;
import com.jiexin.param.WorkFlowStatusCriterionParam;
import com.jiexin.param.WorkFlowStatusParam;
import com.jiexin.service.PlmWorkFlowStatusCriterionService;
import com.jiexin.service.PlmWorkFlowStatusService;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * @Author: Jay_Liu
 * @Description:
 * @Date: Created in 16:57 2018/5/19 0019
 * @Modified By:
 */
@Controller
@RequestMapping("/plm/workFlowStatusCriterion")
public class PlmWorkFlowStatusCriterionController {

    @Resource
    PlmWorkFlowStatusCriterionService criterionService;

    @RequestMapping("/save.json")
    @ResponseBody
    //保存
    public JsonData saveCriterion(WorkFlowStatusCriterionParam param) {
        criterionService.save(param);
        return JsonData.success();
    }

    @RequestMapping("/update.json")
    @ResponseBody
    //更新
    public JsonData updateCriterion(WorkFlowStatusCriterionParam param, HttpServletRequest request) {
        criterionService.update(param);
        return JsonData.success();
    }

    @RequestMapping("/delete.json")
    @ResponseBody
    //删除
    public JsonData deleteCriterion(int criterionId) {
        criterionService.delete(criterionId);
        return JsonData.success();
    }

    @RequestMapping("/page.json")
    @ResponseBody
    //系统工作流数据
    public JsonData list(@Param("statusId") Integer statusId, PageQuery pageQuery) {
        return JsonData.success(criterionService.getPageByStatusId(statusId, pageQuery));
    }


}
